﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Spring.Objects.Factory.Support;
using Strongshell.Recoil.Core.Composition.Parsing;

namespace Strongshell.Recoil.Core.Composition
{
    public interface IObjectConfigurationRegistry
    {
        /// <summary>
        /// Gets or sets the name factory to be used by this <see cref="IObjectConfigurationRegistry"/>.
        /// </summary>
        IObjectNameFactory NameFactory { get; set; }

        /// <summary>
        /// Gets or sets the object definition factory used by this <see cref="IObjectConfigurationRegistry"/>.
        /// </summary>
        IObjectDefinitionFactory ObjectDefinitionFactory { get; set; }

        /// <summary>
        /// Gets the list of object configurations registered by this <see cref="IObjectConfigurationRegistry"/>.
        /// </summary>
        List<ObjectConfiguration> ObjectConfigurations { get; }

        /// <summary>
        /// Register a new object configuration based on the supplied type.
        /// </summary>
        /// <param name="type">The type of the object to be registered.</param>
        /// <returns>A new <see cref="ObjectConfiguration"/> that can be configured.</returns>
        ObjectConfiguration Register(Type type);

        /// <summary>
        /// Registers an object configuration with a unique name. Mostly used for embedded object definitions which
        /// don't have a user supplied name.
        /// </summary>
        /// <param name="type">The type of the object to be registered.</param>
        /// <returns>A new <see cref="ObjectConfiguration"/> that can be configured.</returns>
        ObjectConfiguration RegisterUnique(Type type);
    }
}
